<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>Aria: ArBatteryConnector Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Aria
   &#160;<span id="projectnumber">2.9.4</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li><a href="examples.html"><span>Examples</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('classArBatteryConnector.html','');});
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#nested-classes">Classes</a> &#124;
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pro-methods">Protected Member Functions</a> &#124;
<a href="#pro-attribs">Protected Attributes</a> &#124;
<a href="classArBatteryConnector-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">ArBatteryConnector Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>Connect to robot and battery based on run-time availablitily and command-line arguments.  
 <a href="classArBatteryConnector.html#details">More...</a></p>

<p><code>#include &lt;ArBatteryConnector.h&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Classes</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classArBatteryConnector_1_1BatteryData.html">BatteryData</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Class that holds information about the battery data.  <a href="classArBatteryConnector_1_1BatteryData.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:ab1829cccfc25cd121e6f6df497c6740c"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classArBatteryConnector.html#ab1829cccfc25cd121e6f6df497c6740c">addBattery</a> (<a class="el" href="classArBatteryMTX.html">ArBatteryMTX</a> *battery, int batteryNumber=1)</td></tr>
<tr class="memdesc:ab1829cccfc25cd121e6f6df497c6740c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Adds a battery so parsing will get it.  <a href="#ab1829cccfc25cd121e6f6df497c6740c">More...</a><br /></td></tr>
<tr class="separator:ab1829cccfc25cd121e6f6df497c6740c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa89558b9ab3d847639802db304868928"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classArBatteryConnector.html#aa89558b9ab3d847639802db304868928">ArBatteryConnector</a> (<a class="el" href="classArArgumentParser.html">ArArgumentParser</a> *parser, <a class="el" href="classArRobot.html">ArRobot</a> *robot, <a class="el" href="classArRobotConnector.html">ArRobotConnector</a> *robotConnector, bool autoParseArgs=true, <a class="el" href="classArLog.html#ac8cc0fb3aa323ab2a1c21340fdd1dce3">ArLog::LogLevel</a> infoLogLevel=<a class="el" href="classArLog.html#ac8cc0fb3aa323ab2a1c21340fdd1dce3a6e80d09c67dad73e9ba736e91ec893be">ArLog::Verbose</a>)</td></tr>
<tr class="memdesc:aa89558b9ab3d847639802db304868928"><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructor that takes argument parser.  <a href="#aa89558b9ab3d847639802db304868928">More...</a><br /></td></tr>
<tr class="separator:aa89558b9ab3d847639802db304868928"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a86c0f6642bf77a4851d78005733fa2b2"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a86c0f6642bf77a4851d78005733fa2b2"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classArBatteryConnector.html#a86c0f6642bf77a4851d78005733fa2b2">connectBatteries</a> (bool continueOnFailedConnect=false, bool addConnectedBatteriesToRobot=true, bool addAllBatteriesToRobot=false, bool turnOnBatteries=true, bool powerCycleBatteryOnFailedConnect=true)</td></tr>
<tr class="memdesc:a86c0f6642bf77a4851d78005733fa2b2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Connects all the batteries the robot has that should be auto connected. <br /></td></tr>
<tr class="separator:a86c0f6642bf77a4851d78005733fa2b2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acbbf503c513c718a834a17553cb33eee"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classArBatteryConnector.html#acbbf503c513c718a834a17553cb33eee">connectBattery</a> (<a class="el" href="classArBatteryMTX.html">ArBatteryMTX</a> *battery, int batteryNumber=1, bool forceConnection=true)</td></tr>
<tr class="memdesc:acbbf503c513c718a834a17553cb33eee"><td class="mdescLeft">&#160;</td><td class="mdescRight">Connects the battery synchronously (will take up to a minute)  <a href="#acbbf503c513c718a834a17553cb33eee">More...</a><br /></td></tr>
<tr class="separator:acbbf503c513c718a834a17553cb33eee"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0c2fce4f971b3f663511a71a10c71dc5"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a0c2fce4f971b3f663511a71a10c71dc5"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><b>disconnectBatteries</b> ()</td></tr>
<tr class="separator:a0c2fce4f971b3f663511a71a10c71dc5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2b8b57a4d0eb035b0312ebfbffbc3ed4"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a2b8b57a4d0eb035b0312ebfbffbc3ed4"></a>
<a class="el" href="classArBatteryMTX.html">ArBatteryMTX</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classArBatteryConnector.html#a2b8b57a4d0eb035b0312ebfbffbc3ed4">getBattery</a> (int batteryNumber)</td></tr>
<tr class="memdesc:a2b8b57a4d0eb035b0312ebfbffbc3ed4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Internal function to get the battery (only useful between parseArgs and connectBatteries) <br /></td></tr>
<tr class="separator:a2b8b57a4d0eb035b0312ebfbffbc3ed4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af77b40503f813da3aecb42ada66880a1"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="af77b40503f813da3aecb42ada66880a1"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classArBatteryConnector.html#af77b40503f813da3aecb42ada66880a1">logOptions</a> (void) const </td></tr>
<tr class="memdesc:af77b40503f813da3aecb42ada66880a1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Log the options the simple connector has. <br /></td></tr>
<tr class="separator:af77b40503f813da3aecb42ada66880a1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8bdc4715c9bea24cb2bb3452ae914ff6"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classArBatteryConnector.html#a8bdc4715c9bea24cb2bb3452ae914ff6">parseArgs</a> (void)</td></tr>
<tr class="memdesc:a8bdc4715c9bea24cb2bb3452ae914ff6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Function to parse the arguments given in the constructor.  <a href="#a8bdc4715c9bea24cb2bb3452ae914ff6">More...</a><br /></td></tr>
<tr class="separator:a8bdc4715c9bea24cb2bb3452ae914ff6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afab281000dabec675c0e96d1ab186723"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classArBatteryConnector.html#afab281000dabec675c0e96d1ab186723">parseArgs</a> (<a class="el" href="classArArgumentParser.html">ArArgumentParser</a> *parser)</td></tr>
<tr class="memdesc:afab281000dabec675c0e96d1ab186723"><td class="mdescLeft">&#160;</td><td class="mdescRight">Function to parse the arguments given in an arbitrary parser.  <a href="#afab281000dabec675c0e96d1ab186723">More...</a><br /></td></tr>
<tr class="separator:afab281000dabec675c0e96d1ab186723"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a56f8cb91427dcbb9422eb53b083f4265"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a56f8cb91427dcbb9422eb53b083f4265"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classArBatteryConnector.html#a56f8cb91427dcbb9422eb53b083f4265">replaceBattery</a> (<a class="el" href="classArBatteryMTX.html">ArBatteryMTX</a> *battery, int batteryNumber)</td></tr>
<tr class="memdesc:a56f8cb91427dcbb9422eb53b083f4265"><td class="mdescLeft">&#160;</td><td class="mdescRight">Internal function to replace the battery (only useful between parseArgs and connectBatteries) but not the battery data. <br /></td></tr>
<tr class="separator:a56f8cb91427dcbb9422eb53b083f4265"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad41cf7447885b064496056368efcb9f3"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classArBatteryConnector.html#ad41cf7447885b064496056368efcb9f3">setupBattery</a> (<a class="el" href="classArBatteryMTX.html">ArBatteryMTX</a> *battery, int batteryNumber=1)</td></tr>
<tr class="memdesc:ad41cf7447885b064496056368efcb9f3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets up a battery to be connected.  <a href="#ad41cf7447885b064496056368efcb9f3">More...</a><br /></td></tr>
<tr class="separator:ad41cf7447885b064496056368efcb9f3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a01a13e72f73c076a8320b365aa26cf33"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a01a13e72f73c076a8320b365aa26cf33"></a>
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classArBatteryConnector.html#a01a13e72f73c076a8320b365aa26cf33">~ArBatteryConnector</a> (void)</td></tr>
<tr class="memdesc:a01a13e72f73c076a8320b365aa26cf33"><td class="mdescLeft">&#160;</td><td class="mdescRight">Destructor. <br /></td></tr>
<tr class="separator:a01a13e72f73c076a8320b365aa26cf33"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-methods"></a>
Protected Member Functions</h2></td></tr>
<tr class="memitem:a4931b6aa3f76babb8abf812064fcee8b"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a4931b6aa3f76babb8abf812064fcee8b"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><b>internalConfigureBattery</b> (<a class="el" href="classArBatteryConnector_1_1BatteryData.html">BatteryData</a> *batteryData)</td></tr>
<tr class="separator:a4931b6aa3f76babb8abf812064fcee8b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a419e0cd87afb7f6ef79d6f25d05efa35"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a419e0cd87afb7f6ef79d6f25d05efa35"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classArBatteryConnector.html#a419e0cd87afb7f6ef79d6f25d05efa35">logBatteryOptions</a> (<a class="el" href="classArBatteryConnector_1_1BatteryData.html">BatteryData</a> *batterydata, bool header=true, bool metaOpts=true) const </td></tr>
<tr class="memdesc:a419e0cd87afb7f6ef79d6f25d05efa35"><td class="mdescLeft">&#160;</td><td class="mdescRight">Logs the battery command line option help text. <br /></td></tr>
<tr class="separator:a419e0cd87afb7f6ef79d6f25d05efa35"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a19445ab34b054709cbc2dfe77625c354"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a19445ab34b054709cbc2dfe77625c354"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classArBatteryConnector.html#a19445ab34b054709cbc2dfe77625c354">parseBatteryArgs</a> (<a class="el" href="classArArgumentParser.html">ArArgumentParser</a> *parser, <a class="el" href="classArBatteryConnector_1_1BatteryData.html">BatteryData</a> *batteryData)</td></tr>
<tr class="memdesc:a19445ab34b054709cbc2dfe77625c354"><td class="mdescLeft">&#160;</td><td class="mdescRight">Parses the battery arguments. <br /></td></tr>
<tr class="separator:a19445ab34b054709cbc2dfe77625c354"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-attribs"></a>
Protected Attributes</h2></td></tr>
<tr class="memitem:a5d7a3b2a0c52cb49316491908d2c23c9"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a5d7a3b2a0c52cb49316491908d2c23c9"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><b>myAutoParseArgs</b></td></tr>
<tr class="separator:a5d7a3b2a0c52cb49316491908d2c23c9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afd35ddb4e257dd1a96bf283e9556e12e"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="afd35ddb4e257dd1a96bf283e9556e12e"></a>
std::map&lt; int, <a class="el" href="classArBatteryConnector_1_1BatteryData.html">BatteryData</a> * &gt;&#160;</td><td class="memItemRight" valign="bottom"><b>myBatteries</b></td></tr>
<tr class="separator:afd35ddb4e257dd1a96bf283e9556e12e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a22d38d9cd0d108d4a4194142caf25104"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a22d38d9cd0d108d4a4194142caf25104"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><b>myBatteryLogPacketsReceived</b></td></tr>
<tr class="separator:a22d38d9cd0d108d4a4194142caf25104"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a20a4212a08e3a575ad3b828fae1fcfdd"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a20a4212a08e3a575ad3b828fae1fcfdd"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><b>myBatteryLogPacketsSent</b></td></tr>
<tr class="separator:a20a4212a08e3a575ad3b828fae1fcfdd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aabbea9ab4893cfa826df852af29069b5"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aabbea9ab4893cfa826df852af29069b5"></a>
std::string&#160;</td><td class="memItemRight" valign="bottom"><b>myBatteryTypes</b></td></tr>
<tr class="separator:aabbea9ab4893cfa826df852af29069b5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a30096adc831853b7216af4dc6a3a4aea"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a30096adc831853b7216af4dc6a3a4aea"></a>
<a class="el" href="classArLog.html#ac8cc0fb3aa323ab2a1c21340fdd1dce3">ArLog::LogLevel</a>&#160;</td><td class="memItemRight" valign="bottom"><b>myInfoLogLevel</b></td></tr>
<tr class="separator:a30096adc831853b7216af4dc6a3a4aea"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac557d7a91426d85d7e7400dc5a170a2a"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ac557d7a91426d85d7e7400dc5a170a2a"></a>
<a class="el" href="classArConstFunctorC.html">ArConstFunctorC</a>&lt; <a class="el" href="classArBatteryConnector.html">ArBatteryConnector</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><b>myLogOptionsCB</b></td></tr>
<tr class="separator:ac557d7a91426d85d7e7400dc5a170a2a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae4e991ee0a70e9605cd973975f9333cf"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ae4e991ee0a70e9605cd973975f9333cf"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><b>myOwnParser</b></td></tr>
<tr class="separator:ae4e991ee0a70e9605cd973975f9333cf"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9a50969999004d6c51bafe18083f260f"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a9a50969999004d6c51bafe18083f260f"></a>
<a class="el" href="classArRetFunctorC.html">ArRetFunctorC</a>&lt; bool, <a class="el" href="classArBatteryConnector.html">ArBatteryConnector</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><b>myParseArgsCB</b></td></tr>
<tr class="separator:a9a50969999004d6c51bafe18083f260f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a72d11bc85a1a125678f186f475b80c97"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a72d11bc85a1a125678f186f475b80c97"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><b>myParsedArgs</b></td></tr>
<tr class="separator:a72d11bc85a1a125678f186f475b80c97"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a648958bccafaef57f902d432a63915d3"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a648958bccafaef57f902d432a63915d3"></a>
<a class="el" href="classArArgumentParser.html">ArArgumentParser</a> *&#160;</td><td class="memItemRight" valign="bottom"><b>myParser</b></td></tr>
<tr class="separator:a648958bccafaef57f902d432a63915d3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5d2ad9ab1021830dbb6594f73bc5b1c6"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a5d2ad9ab1021830dbb6594f73bc5b1c6"></a>
<a class="el" href="classArRobot.html">ArRobot</a> *&#160;</td><td class="memItemRight" valign="bottom"><b>myRobot</b></td></tr>
<tr class="separator:a5d2ad9ab1021830dbb6594f73bc5b1c6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad871659b68a8a4bf5b4ee2848edac4ab"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ad871659b68a8a4bf5b4ee2848edac4ab"></a>
<a class="el" href="classArRobotConnector.html">ArRobotConnector</a> *&#160;</td><td class="memItemRight" valign="bottom"><b>myRobotConnector</b></td></tr>
<tr class="separator:ad871659b68a8a4bf5b4ee2848edac4ab"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Connect to robot and battery based on run-time availablitily and command-line arguments. </p>
<p><a class="el" href="classArBatteryConnector.html" title="Connect to robot and battery based on run-time availablitily and command-line arguments. ">ArBatteryConnector</a> makes a battery connection either through a serial port connection, or through a TCP port (for the simulator or for robots with Ethernet-serial bridge devices instead of onboard computers). Normally, it first attempts a TCP connection on <em>localhost</em> port 8101, to use a simulator if running. If the simulator is not running, then it normally then connects using the serial port Various connection parameters are configurable through command-line arguments or in the robot parameter file. (Though the internal interface used by ARIA to do this is also available if you need to use it: See <a class="el" href="classArBatteryConnector.html#ab1829cccfc25cd121e6f6df497c6740c" title="Adds a battery so parsing will get it. ">addBattery()</a>; otherwise don't use <a class="el" href="classArBatteryConnector.html#ab1829cccfc25cd121e6f6df497c6740c" title="Adds a battery so parsing will get it. ">addBattery()</a>, <a class="el" href="classArBatteryConnector.html#ad41cf7447885b064496056368efcb9f3" title="Sets up a battery to be connected. ">setupBattery()</a>, etc.).</p>
<p>When you create your <a class="el" href="classArBatteryConnector.html" title="Connect to robot and battery based on run-time availablitily and command-line arguments. ">ArBatteryConnector</a>, pass it command line parameters via either the argc and argv variables from main(), or pass it an <a class="el" href="classArArgumentBuilder.html" title="This class is to build arguments for things that require argc and argv. ">ArArgumentBuilder</a> or <a class="el" href="classArArgumentParser.html" title="Parse and store program command-line arguments for use by other ARIA classes. ">ArArgumentParser</a> object. (<a class="el" href="classArArgumentBuilder.html" title="This class is to build arguments for things that require argc and argv. ">ArArgumentBuilder</a> is able to obtain command line parameters from a Windows program that uses WinMain() instead of main()). <a class="el" href="classArBatteryConnector.html" title="Connect to robot and battery based on run-time availablitily and command-line arguments. ">ArBatteryConnector</a> registers a callback with the global <a class="el" href="classAria.html" title="Contains global initialization, deinitialization and other global functions. ">Aria</a> class. Use <a class="el" href="classAria.html#a1b090c01d88bb420b8cf8e0384d25ee1" title="Parses the arguments for the program (calls all the callbacks added with addParseArgsCB()) ...">Aria::parseArgs()</a> to parse all command line parameters to the program, and <a class="el" href="classAria.html#a10d71f3d4d0cf7f38c58a1f749f64a42" title="Logs all the options for the program (Calls all the callbacks added with addLogOptionsCB()) ...">Aria::logOptions()</a> to print out information about all registered command-line parameters.</p>
<p>The following command-line arguments are checked: </p><pre class="fragment">Options for ArBatteryConnector:
-batteryLogPacketsReceived
-blpr
-batteryLogPacketsSent
-blps

Options shown are for currently set up batteries.  Activate batteries with -batteryType&lt;N&gt; option
to see options for that battery (e.g. "-help -batteryType1 batteryMTX").
Valid battery types are: mtx

See docs for details.
</pre><p>To connect to any batteries that were set up in the robot parameter file or via command line arguments, call <a class="el" href="classArBatteryConnector.html#a86c0f6642bf77a4851d78005733fa2b2" title="Connects all the batteries the robot has that should be auto connected. ">connectBatteries()</a>. If successful, <a class="el" href="classArBatteryConnector.html#a86c0f6642bf77a4851d78005733fa2b2" title="Connects all the batteries the robot has that should be auto connected. ">connectBatteries()</a> will return true and add an entry for each battery connected in the <a class="el" href="classArRobot.html" title="Central class for communicating with and operating the robot. ">ArRobot</a> object's list of batteries. These <a class="el" href="classArBatteryMTX.html">ArBatteryMTX</a> objects can be accessed from your <a class="el" href="classArRobot.html" title="Central class for communicating with and operating the robot. ">ArRobot</a> object via <a class="el" href="classArRobot.html#a5b8a87b2399924dc0cd5b9ec1e06bd44" title="Finds a battery in the robot&#39;s list (batteryNumber indices start at 1) (MTX robots only) ...">ArRobot::findBattery()</a> or <a class="el" href="classArRobot.html#aeb1d83e7bde2b58e838a4ae4876444e3" title="Gets the battery list. ">ArRobot::getBatteryMap()</a>.</p>
<dl class="section since"><dt>Since</dt><dd>2.8.0 </dd></dl>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="aa89558b9ab3d847639802db304868928"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">ArBatteryConnector::ArBatteryConnector </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classArArgumentParser.html">ArArgumentParser</a> *&#160;</td>
          <td class="paramname"><em>parser</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="classArRobot.html">ArRobot</a> *&#160;</td>
          <td class="paramname"><em>robot</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="classArRobotConnector.html">ArRobotConnector</a> *&#160;</td>
          <td class="paramname"><em>robotConnector</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>autoParseArgs</em> = <code>true</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="classArLog.html#ac8cc0fb3aa323ab2a1c21340fdd1dce3">ArLog::LogLevel</a>&#160;</td>
          <td class="paramname"><em>infoLogLevel</em> = <code><a class="el" href="classArLog.html#ac8cc0fb3aa323ab2a1c21340fdd1dce3a6e80d09c67dad73e9ba736e91ec893be">ArLog::Verbose</a></code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Constructor that takes argument parser. </p>
<dl class="section warning"><dt>Warning</dt><dd>do not delete <em>parser</em> during the lifetime of this <a class="el" href="classArBatteryConnector.html" title="Connect to robot and battery based on run-time availablitily and command-line arguments. ">ArBatteryConnector</a>, which may need to access its contents later. </dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">parser</td><td>the parser with the arguments to parse </td></tr>
    <tr><td class="paramname">robot</td><td>the robot these batteries are attached to (or NULL for none) </td></tr>
    <tr><td class="paramname">robotConnector</td><td>the connector used for connecting to the robot (so we can see if it was a sim or not) </td></tr>
    <tr><td class="paramname">autoParseArgs</td><td>if this class should autoparse the args if they aren't parsed explicitly </td></tr>
    <tr><td class="paramname">infoLogLevel</td><td>The log level for information about creating batteries and such, this is also passed to all the batteries created as their infoLogLevel too </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="ab1829cccfc25cd121e6f6df497c6740c"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool ArBatteryConnector::addBattery </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classArBatteryMTX.html">ArBatteryMTX</a> *&#160;</td>
          <td class="paramname"><em>battery</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>batteryNumber</em> = <code>1</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Adds a battery so parsing will get it. </p>
<p>Normally adding batteries is done from the .p file, you can use this if you want to add them explicitly in a program (which will override the .p file, and may cause some problems).</p>
<p>This is mainly for backwards compatibility (ie used for <a class="el" href="classArSimpleConnector.html" title="Legacy connector for robot and laser. ">ArSimpleConnector</a>). If you're using this class you should probably use the new functionality which is just <a class="el" href="classArBatteryConnector.html#a86c0f6642bf77a4851d78005733fa2b2" title="Connects all the batteries the robot has that should be auto connected. ">ArBatteryConnector::connectBatteries</a>.() </p>

</div>
</div>
<a class="anchor" id="acbbf503c513c718a834a17553cb33eee"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool ArBatteryConnector::connectBattery </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classArBatteryMTX.html">ArBatteryMTX</a> *&#160;</td>
          <td class="paramname"><em>battery</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>batteryNumber</em> = <code>1</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>forceConnection</em> = <code>true</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Connects the battery synchronously (will take up to a minute) </p>
<p>This is mainly for backwards compatibility (ie used for <a class="el" href="classArSimpleConnector.html" title="Legacy connector for robot and laser. ">ArSimpleConnector</a>).</p>
<p>If you're using this class you should probably use the new functionality which is just <a class="el" href="classArBatteryConnector.html#a86c0f6642bf77a4851d78005733fa2b2" title="Connects all the batteries the robot has that should be auto connected. ">ArBatteryConnector::connectBatteries()</a>. </p>

</div>
</div>
<a class="anchor" id="a8bdc4715c9bea24cb2bb3452ae914ff6"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool ArBatteryConnector::parseArgs </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Function to parse the arguments given in the constructor. </p>
<p>Parse command line arguments using the <a class="el" href="classArArgumentParser.html" title="Parse and store program command-line arguments for use by other ARIA classes. ">ArArgumentParser</a> given in the <a class="el" href="classArBatteryConnector.html" title="Connect to robot and battery based on run-time availablitily and command-line arguments. ">ArBatteryConnector</a> constructor.</p>
<p>See <a class="el" href="classArBatteryConnector.html#afab281000dabec675c0e96d1ab186723" title="Function to parse the arguments given in an arbitrary parser. ">parseArgs(ArArgumentParser*)</a> for details about argument parsing.</p>
<dl class="section return"><dt>Returns</dt><dd>true if the arguments were parsed successfully false if not </dd></dl>

</div>
</div>
<a class="anchor" id="afab281000dabec675c0e96d1ab186723"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool ArBatteryConnector::parseArgs </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classArArgumentParser.html">ArArgumentParser</a> *&#160;</td>
          <td class="paramname"><em>parser</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Function to parse the arguments given in an arbitrary parser. </p>
<p>Parse command line arguments held by the given <a class="el" href="classArArgumentParser.html" title="Parse and store program command-line arguments for use by other ARIA classes. ">ArArgumentParser</a>.</p>
<dl class="section return"><dt>Returns</dt><dd>true if the arguments were parsed successfully false if not</dd></dl>
<p>The following arguments are accepted for battery connections. A program may request support for more than one battery using setMaxNumBatteries(); if multi-battery support is enabled in this way, then these arguments must have the battery index number appended. For example, "-batteryPort" for battery 1 would instead by "-batteryPort1", and for battery 2 it would be "-batteryPort2". </p><dl>
<dt>-batteryPort <em>port</em> </dt>
<dd></dd>
<dt>-bp <em>port</em> </dt>
<dd>Use the given port device name when connecting to a battery. For example, <code>COM2</code> or on Linux, <code>/dev/ttyS1</code>.  </dd>
<dt>-doNotConnectBattery </dt>
<dd></dd>
<dt>-dncb </dt>
<dd></dd>
</dl>

</div>
</div>
<a class="anchor" id="ad41cf7447885b064496056368efcb9f3"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool ArBatteryConnector::setupBattery </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classArBatteryMTX.html">ArBatteryMTX</a> *&#160;</td>
          <td class="paramname"><em>battery</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>batteryNumber</em> = <code>1</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Sets up a battery to be connected. </p>
<p>This is mainly for backwards compatibility (ie used for <a class="el" href="classArSimpleConnector.html" title="Legacy connector for robot and laser. ">ArSimpleConnector</a>).</p>
<p>If you're using this class you should probably use the new functionality which is just <a class="el" href="classArBatteryConnector.html#a86c0f6642bf77a4851d78005733fa2b2" title="Connects all the batteries the robot has that should be auto connected. ">ArBatteryConnector::connectBatteries()</a>. </p>

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>ArBatteryConnector.h</li>
<li>ArBatteryConnector.cpp</li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="classArBatteryConnector.html">ArBatteryConnector</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.11 </li>
  </ul>
</div>
</body>
</html>
